package com.hundsun.cprs.yyt.service.trade.enums;

import java.util.HashMap;
import java.util.Map;

public enum EnumTradeStatus {

    INIT(1, "待审核"), COMMITED(2, "挂售中"), CANCELED(3, "已撤单"), DEALT(4, "已完成");

    private Integer status;
    private String desc;

    private EnumTradeStatus(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    /**
     * 全局索引池
     */
    private static Map<Integer, EnumTradeStatus> pool = new HashMap<Integer, EnumTradeStatus>();
    static {
        for (EnumTradeStatus et : EnumTradeStatus.values()) {
            pool.put(et.getStatus(), et);
        }
    }

    /**
     * 根据内容索引
     *
     * @param code
     * @return
     */
    public static EnumTradeStatus indexByValue(Integer status) {
        return pool.get(status);
    }

    public static Map<Integer, EnumTradeStatus> toMap() {
        return pool;
    }

    public Integer getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }
}
